<?php


class Ext_User_Action_Edit_Email_Adapter
{
    private $_adapter;

    public function __construct($userId)
    {
    	if(!isset($this->_adapter))
    	{
    		$front = Zend_Controller_Front::getInstance();
			$bootstrap = $front->getParam('bootstrap');
			$options = $bootstrap->getApplication()->getOptions();
			
	    	$classname = "Ext_User_Action_Edit_Email_Adapter_".ucfirst($options['auth']['adapter']['base']);
	    	if(!class_exists( $classname ))
	    	{
	    		require_once 'Ext/User/Action/Edit/Email/Exception.php';
	          	throw new Ext_User_Action_Edit_Email_Exception("Edit adapter '".$classname."' is not exists.");
	    	}
	    	
	    	$this->_adapter = new $classname($userId);
    	}
    }
    
    public function getAdapter()
    {
		return $this->_adapter;
    }
}
